// Promise-成功
<template>
  <div>
    <prism language="javascript">
      var promise = new Promise(function(resolve, reject) {
      // 异步处理代码处
      resolve("yuan");
      // reject("失败了:(");
      });

      //成功之后的处理
      promise.then(function(data) {
      console.log("data from promise: " + data);
      });
    </prism>
    <v-btn
      round
      color="success"
      @click="run"
    >
      RUN
    </v-btn>
  </div>
</template>

<script>
import Prism from "vue-prism-component";
export default {
  components: {
    Prism
  },
  methods: {
    run() {
      var promise = new Promise(function(resolve, reject) {
        // 异步处理代码处
        resolve("yuan");
        // reject("失败了:(");
      });

      //成功之后的处理
      promise.then(function(data) {
        console.log("data from promise: " + data);
      });
    }
  }
};
</script>